from rest_framework import serializers
from goods.models import SKU
class SkuSerializer(serializers.ModelSerializer):

    """sku序列化器"""

    #关联嵌套序列化指定字段
    skus = serializers.StringRelatedField(read_only=True)

    category = serializers.StringRelatedField(read_only=True)
    class Meta:
        models = SKU
        fields = {'id','name','price','stock','category','is_launched'}

